package com.vim.modules.mall.controller;

import com.github.pagehelper.PageInfo;
import com.vim.modules.mall.model.base.Page;
import com.vim.modules.mall.model.mallOrder.MallOrderReturnApply;
import com.vim.modules.mall.service.MallOrderReturnApplyService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @作者 Administrator
 * @时间 2020-10-06 14:58
 * @版本 1.0
 */
@Controller
@RequestMapping(value = "/mall/orderReturnApply")
public class MallOrderReturnApplyController {

    @Autowired
    private MallOrderReturnApplyService mallOrderReturnApplyService;

    /**
     * 列表页面
     */
    @RequiresPermissions(value = "mall:orderReturnApply:list")
    @RequestMapping(value = "/list")
    public String list(){
        return "mall/order/orderReturnApplyList";
    }

    /**
     * 列表数据
     * @param pageNo    页码
     * @param pageSize  每页数量
     */
    @RequiresPermissions(value = "mall:orderReturnApply:list")
    @RequestMapping(value = "/dataList")
    @ResponseBody
    public PageInfo<MallOrderReturnApply> dataList(
            @RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
            @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize){
        return mallOrderReturnApplyService.orderReturnApplyPageList(new Page(pageNo,pageSize));
    }

    /**
     * 售后详情
     */
    @RequiresPermissions(value = "mall:orderReturnApply:list")
    @RequestMapping(value = "/detail")
    public String detail(Long id, Model model){
        model.addAttribute("mallOrderReturnApply", mallOrderReturnApplyService.orderReturnApplyInfo(id));
        return "mall/order/orderReturnApplyDetail";
    }
}
